
package com.faithbj.device.dao.impl;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Example;
import org.springframework.stereotype.Repository;

import com.faithbj.device.dao.DeviceInfoDao;
import com.faithbj.device.model.configuration.Pager;
import com.faithbj.device.model.configuration.Pager.OrderType;
import com.faithbj.device.model.entity.DeviceInfo;

/**
 * @author jrn E-mail: rinanjin@gmail.com
 * @version 0.1 
 * <br/>创建时间：2012-5-15 上午12:22:28
 * <br/>类说明：DeviceInfo DAO
 */
@Repository("deviceInfoDao")
public class DeviceInfoDaoImpl extends BaseDaoImpl<DeviceInfo, String> implements DeviceInfoDao
{
	@Override
	public Pager findByPager(Pager pager, DeviceInfo deviceInfo)
	{
		if(pager == null)
		{
			pager = new Pager();
			pager.setOrderBy("id");
			pager.setOrderType(OrderType.asc);
		}
		DetachedCriteria detachedCriteria = DetachedCriteria.forClass(DeviceInfo.class);
		detachedCriteria.add(Example.create(deviceInfo));
		return super.findByPager(pager, detachedCriteria);
	}
}
